package com.yb0os1.mapper;

import com.yb0os1.entity.User;
import com.yb0os1.entity.UserStatistics;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface UserMapper {
    @Select("select * from user where openid = #{openid}")
    User getUserByOpenid(String openid);

    void insert(User user);
    @Select("select * from user where id = #{id}")
    User getById(Long userId);

    List<UserStatistics> getUserStatistics(LocalDate begin, LocalDate end);

    @Select("select count(*) from user where date(create_time) between #{begin} and #{end}")
    Integer getUser(LocalDate begin, LocalDate end);
}
